package com.lmf;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableEurekaServer
@RestController
/*@ComponentScan("com.lmf.mapper")*/
@MapperScan("com.lmf.mapper")
public class ColonyTestApplication {
	private static Logger logger= LoggerFactory.getLogger(ColonyTestApplication.class);
	@Value("${server.port}")
	String port;

	public static void main(String[] args) {
		SpringApplication.run(ColonyTestApplication.class, args);
	}

	/**
	 * 测试fegion接口
	 */
	@GetMapping("/hello/{name}")
	public String hello(@PathVariable(name = "name")String username){
		logger.info("request two name is"+username);
		try {
			Thread.sleep(8000);
		}catch (Exception e){
			e.printStackTrace();
			logger.error("hello two error");
		}
		return "hello"+username+"来到"+port+"的页面";
	}


}
